home *** CD-ROM | disk | FTP | other *** search
- Path: hai.hiMolde.no!runee
- From: runee@hai.hiMolde.no (Rune Espeseth)
- Newsgroups: comp.sys.amiga.programmer,uiuc.class.cs110c,uiuc.class.cs223
- Subject: Re: How do I define my integers?
- Followup-To: comp.sys.amiga.programmer,uiuc.class.cs110c,uiuc.class.cs223
- Date: 15 Jan 1996 23:56:36 GMT
- Organization: Molde College, Department of Computer Science
- Message-ID: <4depjk$mvi@ulke.hiMolde.no>
- References: <4d73ug$25v@vixen.cso.uiuc.edu>
- NNTP-Posting-Host: hai.himolde.no
- X-Newsreader: TIN [version 1.2 PL2]
-
- howard daniel joseph (djhoward@ux5.cso.uiuc.edu) wrote:
- : Okay. I'm writing a program under GCC on my Amiga.
-
- : But I'm confused to hell over integer limits.
-
- : My book talks about 2 bit and 4 bit integers ... and four bit
- ^^^^^^^^^^^^^^^^^
- That's 2 byte and 4 byte integers (word and longword, respectively.)
-
- : integers like what it describers long integers to be. Of course there's
- : unsigned integers and the like too.
-
- : How do I declare signed versus unsigned integers?
-
- #include <exec/types.h>
-
- unsigned long my32bitnumber; // Longword 0-4millionsomething (2^32)
- signed word my16bit_s_number; // WORD -32768 - 32767 ....
-
- or with the include mentioned above:
-
- ULONG my32bitnumber;
- WORD my16bit_s_number;
-
- : How do I know how many bits my integers are using?
-
- BYTE=8 bit , WORD=16 bit and LONG =32bit.
-
- : How do I declare signed and unsigned long integers?
-
- See above... :-)
-
- : What's with these "doubles" the book mysteriously alludes to?
-
- double long my64bitint; (..or was it long double... can't remember...)
-
- : What *am* I creating when I type;
-
- : int somevalue;
- Depends... Some compilers let you set the int size.
- Guess it's signed...
- : (ie Is it signed/unsigned? How many bits?)
-
- : I know many of the answers here, but if I could get them all from one
- : source I'd feel a lot better.
-
- : I need two sorts of values for my project;
-
- : An integer (unsigned) that can handle, 6, though ideally 9 places (Just
- : under 250000000 would be the maximum forseen possible value here.)
-
- Sounds like you have to go for double....
-
- : An integer that can handle a much bigger number ... 12 places at least for
- : now.
-
- : Can I perform simple maths (addition, division) between integers of
- : different types? I'd assume so, right?
-
- Yes, but you have to cast it to the right type first...
-
- Good luck!
-
- --
- Regards,
- Rune Espeseth
-
- -------------
- CyberStorm060/50Mhz, CyberVision64/4Mb
- Computer Information Science Student at Molde College, Norway
- Email: lakris@ask.himolde.no | Rune.Espeseth@himolde.no
-